#include "stdafx.h"
#include "POP3.h"

namespace POP3_TABLE
{
	//game info
	ValueTableEntry m_character_list[] =
	{
		VALUE_ENTRY_R(0, "Prince (infected)"),
		VALUE_ENTRY_R(1, "Dark Prince"),
		VALUE_ENTRY_R(2, "Prince"),
	};

	ValueTableEntry m_difficulty_list[] =
	{
		VALUE_ENTRY_R(0, "Easy"),
		VALUE_ENTRY_R(1, "Normal"),
		VALUE_ENTRY_R(2, "Hard"),
	};

	//player info 1
	ValueTableEntry m_sec_weapon_list[] =
	{
		VALUE_ENTRY_R(0x51002522, "[%idh] Sword (gains sands)"),
		VALUE_ENTRY_R(0x51002525, "[%idh] Sword"),
		VALUE_ENTRY_R(0x13015B32, "[%idh] Melee"),
		VALUE_ENTRY_R(0x13015B40, "[%idh] Sword"),
		VALUE_ENTRY_R(0x13015B8F, "[%idh] Mace"),
	};

	//player info 2
	ValueTableEntry m_health_list[] =
	{
		VALUE_ENTRY_R(125, "0 life upgrades (%id)"),
		VALUE_ENTRY_R(146, "1 life upgrades (%id)"),
		VALUE_ENTRY_R(167, "2 life upgrades (%id)"),
		VALUE_ENTRY_R(188, "3 life upgrades (%id)"),
		VALUE_ENTRY_R(209, "4 life upgrades (%id)"),
		VALUE_ENTRY_R(230, "5 life upgrades (%id)"),
		VALUE_ENTRY_R(251, "6 life upgrades (%id)"),
	};

	ValueTableEntry m_sand_pow_list[] =
	{
		VALUE_ENTRY_R(0, "None"),
		VALUE_ENTRY_R(1, "Recall"),
		VALUE_ENTRY_R(2, "Eye of the Storm"),
		VALUE_ENTRY_R(3, "Winds of Sand"),
		VALUE_ENTRY_R(4, "Sand Storm"),
	};

	ValueTableEntry m_prim_weapon_list[] =
	{
		VALUE_ENTRY_R(0xFFFFFFFF, "NoWeapon"),
		VALUE_ENTRY_R(0x00000000, "Dagger"),
		VALUE_ENTRY_R(0x00000001, "Dagger of Time"),
		VALUE_ENTRY_R(0x00000002, "Sharaman's Sword"),
	};

	MainTableEntry m_game_info_table[] = 
	{
		MAIN_ENTRY_L("Character Selection",			0xA0, sizeof(u8 ), m_character_list),
		MAIN_ENTRY_L("Difficulty",					0xB0, sizeof(u8 ), m_difficulty_list),
	};

	MainTableEntry m_player_info1_table[] = 
	{
		MAIN_ENTRY_R("Sand Credits",				0x10, sizeof(u16), TYPE_VALUE),
		MAIN_ENTRY_L("Secondary Weapon",			0x38, sizeof(u32), m_sec_weapon_list),
	};

	MainTableEntry m_player_info2_table[] = 
	{
		MAIN_ENTRY_R("Current Health",				0x00, sizeof(u16), TYPE_VALUE_RANGE_I_R, 0, (u32)&m_player_info2_table[1]),
		MAIN_ENTRY_L("Maximum Health",				0x02, sizeof(u16), m_health_list),
		MAIN_ENTRY_R("Current Sand Tanks",			0x04, sizeof(u16), TYPE_VALUE_RANGE_I_R, 0, (u32)&m_player_info2_table[6]),
		MAIN_ENTRY_L("Current Sand Powers",			0x06, sizeof(u16), m_sand_pow_list),
		MAIN_ENTRY_R("Secondary Weapon Durabity",	0x0A, sizeof(u16), TYPE_VALUE),
		MAIN_ENTRY_L("Primary Weapon",				0x0C, sizeof(u32), m_prim_weapon_list),
		MAIN_ENTRY_R("Maximum Sand Tanks",			0x14, sizeof(u16), TYPE_VALUE_RANGE_I_I, 0, 6),
	};

	OffsetListEntry m_player_info2_offset_table[] =
	{
		OFFSET_ENTRY_V(0xbc4c, 0x66038e35, u32, 0xbc58), //normal
		OFFSET_ENTRY_V(0xbc4c, 0xb9008df0, u32, 0xbc7c), //offset 1
		OFFSET_ENTRY_V(0xbc4c, 0x69003db2, u32, 0xbca0), //offset 2
	};

	TableListEntry m_table_list[] =
	{
		LIST_ENTRY_R(m_game_info_table),
		LIST_ENTRY_R(m_player_info1_table),
		LIST_ENTRY_L(m_player_info2_table, m_player_info2_offset_table),
	};
}

POP3::POP3() : FileTableGUI()
{
}

bool POP3::Test(const wxString& path)
{
	Init(POP3_TABLE::m_table_list, WXSIZEOF(POP3_TABLE::m_table_list));

	return wxFileName(path).GetFullName().CmpNoCase("PSPPOP3.BIN") == 0;
}